﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Data;
using Entities;
namespace Business
{
   public class SachService
    {
        public static DataTable GetSachTable()
        {
            DataTable kq = new DataTable();
            kq = Data.ConvertTo.DataTable(SachRepository.GetSachList());
            return kq;
        }
        public static DataTable GetSachTable(int skip, int take)
        {
            DataTable kq = new DataTable();
            kq = Data.ConvertTo.DataTable(SachRepository.GetSachList(skip,take));
            return kq;
        }
        public static DataTable GetSachDeletedTable()
        {
            DataTable kq = new DataTable();
            kq = Data.ConvertTo.DataTable(SachRepository.GetSachDeletedList());
            return kq;
        }
        public static List<SachDTO> GetDeletedSachList()
        {
            return SachRepository.GetSachDeletedList();
        }
       public static List<SachDTO> GetSachList()
       {
           return SachRepository.GetSachList();
       }

       public static SachDTO GetSachByMaSach(int maSach)
       {
           SachDTO kq = new SachDTO();
           kq = SachRepository.GetSachByMaSach(maSach);
           return kq;
       }
       public static int GetSoLuongByMaSach(int maSach)
       {
           return SachRepository.GetSachByMaSach(maSach).SoLuong;
       }
       public static List<SachDTO> SearchByTenSach(string tenSach)
       {
           return SachRepository.SearchByTenSach(tenSach);
       }

       public static List<SachDTO> Search(string tenSach, string tenTheLoai, string tenTacGia, double gia, int loaiGia, int soLuong, int loaiSoLuong)
       {
          return SachRepository.Search(tenSach, tenTheLoai, tenTacGia, gia, loaiGia, soLuong, loaiSoLuong);
       }
       public static List<SachDTO> Search(string tenSach, string tenTheLoai, string tenTacGia, double gia, int loaiGia)
       {
           return SachRepository.Search(tenSach, tenTheLoai, tenTacGia, gia, loaiGia);
       }
       public static List<SachDTO> Search(string tenSach, string tenTheLoai, string tenTacGia,  int soLuong, int loaiSoLuong)
       {
           return SachRepository.Search(tenSach, tenTheLoai, tenTacGia,  soLuong, loaiSoLuong);
       }
       public static List<SachDTO> Search(string tenSach, string tenTheLoai, string tenTacGia)
       {
           return SachRepository.Search(tenSach, tenTheLoai, tenTacGia);
       }
       public static bool CheckDelete(int maSach)
       {
           return SachRepository.CheckDelete(maSach);

       }
       public static int GetCurrentID()
       {
           return SachRepository.GetCurrentID();
       }
       public static void Insert(SachDTO sach)
       {
           SachRepository.Insert(sach);
       }
       public static void SetDelete(int maSach)
       {
           SachRepository.SetDelete(maSach);
       }
       public static void Update(SachDTO sach)
       {
           SachRepository.Update(sach);
       }
       public static void Delete(int maSach)
       {
           SachRepository.Delete(maSach);
       }
       public static void Undelete(int maSach)
       {
           SachRepository.Undelete(maSach);
       }
    }
}
